<?php
$rule = array("#^(.+)#i" => '/index\\1');

foreach ($rule as $key => $value) {
	if (preg_match($key, $info)) {
		$info = preg_replace($key, $value, $info);
		
		if ($info[0] == '!') {
			$info = substr($info, 1);
			
			break;
		}
	}
}